
package com.jy.framework.sys.entity;


import java.io.Serializable;
import java.util.List;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.jy.framework.base.BaseEntity;
import com.jy.framework.validator.group.AddGroup;
import com.jy.framework.validator.group.UpdateGroup;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

/**
 * 系统用户
 * 
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2016年9月18日 上午9:28:55
 */

@ApiModel(value = "系统用户")
@TableName("sys_user")
@Data
@Getter
@Setter
public class SysUserEntity extends BaseEntity implements Serializable {
	private static final long serialVersionUID = 1L;



	/**
	 * 主键
	 */
	@TableId
	@ApiModelProperty(value = "主键")
	private Long id;
	/**
	 * 用户名
	 */
	@Excel(name="用户名")
	@NotBlank(message="用户名不能为空", groups = {AddGroup.class, UpdateGroup.class})
	private String username;

	/**
	 * 密码
	 */
	@NotBlank(message="密码不能为空", groups = AddGroup.class)
	@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
	private String password;

	/**
	 * 盐
	 */
	private String salt;

	/**
	 * 邮箱
	 */
	@Excel(name="邮箱")
	@NotBlank(message="邮箱不能为空", groups = {AddGroup.class, UpdateGroup.class})
	@Email(message="邮箱格式不正确", groups = {AddGroup.class, UpdateGroup.class})
	private String email;

	/**
	 * 手机号
	 */
	@Excel(name="手机号")
	@NotBlank(message="手机号不能为空", groups = {AddGroup.class, UpdateGroup.class})
	@Pattern(regexp = "^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\\\\d{8}$",message = "请填写正确的手机号！")
	private String mobile;

	/**
	 * 状态  0：禁用   1：正常
	 */
	@Excel(name="状态  0：禁用   1：正常")
	private Integer status;

	/**
	 * 角色ID列表
	 */
	@TableField(exist=false)
	private List<Long> roleIdList;

	/**
	 * 部门ID
	 */
	@Excel(name="部门ID")
	@NotNull(message="部门不能为空", groups = {AddGroup.class, UpdateGroup.class})
	private Long deptId;

	@TableField(exist = false)
	private List<Long> dataScopeDeptIds;

	@TableField(exist = false)
	private List<Long> subDeptIds;

	/**
	 * 部门名称
	 */
	@Excel(name="部门名称")
	@TableField(exist=false)
	private String deptName;
	/**
	 * 用户类型
	 */
	private Integer userType;

	/**
	 * 用户信息id
	 */
	private Long userInfoId;
	@Excel(name="姓名")
	@NotNull(message="用户全名不能为空", groups = {AddGroup.class, UpdateGroup.class})
	private String fullName;

}
